package No0073_set_matrix_zeroes

func setZeroes(matrix [][]int) {
	var set_x map[int]struct{}
	var set_y map[int]struct{}
	set_x = make(map[int]struct{})
	set_y = make(map[int]struct{})
	for i := 0; i < len(matrix); i++ {
		for j := 0; j < len(matrix[0]); j++ {
			if matrix[i][j] == 0 {
				set_x[i] = struct{}{}
				set_y[j] = struct{}{}
			}
		}
	}

	for i := 0; i < len(matrix); i++ {
		for j := 0; j < len(matrix[0]); j++ {
			_, col := set_x[i]
			_, rank := set_y[j]
			if col || rank {
				matrix[i][j] = 0
			}
		}
	}

}
